<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button onclick="click1()">去1</button>
<button onclick="click2()">去2</button>
<button onclick="click3()">去3</button>
<button onclick="click4()">replace</button>
<button onclick="click5()">reload1</button>
<button onclick="click6()">reload2</button>
<script>
    /*
        location.assign
            - 立即导航到新的url地址
     */
    const url = 'https://www.dogedoge.com'

    // 三种导航方法

    function click1() {
        location.assign(url);
    }

    function click2() {
        window.location = url;
    }

    function click3() {
        location.href = url
    }


    /*
        location.replace() 
            - 不保存历史记录 ,就没有了返回按钮
     */
    function click4() {
        location.replace(url)
    }
    
    /*
        location.reload() 
            - 重新加载,可能是从缓存中加载
            - 加上参数true 从服务器加载
     */
    function click5() {
        location.reload()
    }
    function click6() {
        location.reload(true)
    }
</script>
</body>
</html>